package com.yc.springmvc.bean;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import java.util.Date;
import java.util.List;

@Data
public class Person {
    @NotEmpty(message = "账号不为空")
    @Length(min = 2,max = 16,message = "账号长度必须为2-16个字符")
    String name;
    Integer age;
    Boolean student;
    @NotEmpty(message = "密码不能为空")
    @Length(min = 6,max = 16,message = "密码长度必须是6-16个字符")
    String pwd;
    @Email
    String email;
    @Pattern(regexp = "1\\d{10}",message = "电话必须是1开头的11位数字")
    String phone;
    Date birthday;

    Person father;
    Person mather;
    List<Person> friends;

}
